﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApp
{
    public partial class AddNote : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void sBtn_Click(object sender, EventArgs e)
        {
            var keys = keyTxb.Text.Trim();
            var title = titleTxb.Text.Trim();
            var content = contentTxb.Text.Trim();

            string sql = string.Format("insert into Note(Keys,Title,Content) values('{0}','{1}','{2}')", keys, title, content);

            var res = DbHelper.UpdateData(sql);
            if (res > 0)
            {
                Response.Redirect("Default.aspx");
            }
            else
            {
                Response.Write("<script>alert('添加失败')</script>");
            }

        }

        protected void fhBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
        }
    }
}